<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>类的继承与super关键字的使用</title>
</head>
<body>
<script>
  class Father{
    constructor(x,y) {
      this.x = x;
      this.y = y;
    }
    sum() {
      console.log(this.x + this.y);
    }
  }
  class Son extends Father {
      constructor(x,y) {
        super(x,y);//调用父类的构造函数
      }
  }
  var son = new Son(1,2);
  var son1 = new Son(11,22);
  son.sum();
  son1.sum();
</script>
</body>
</html>